package com.csii.mobilebanking.user;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class SharedPre {
	// Share Key Name
	public static final String SHARED_PREFERENCE_NAME = "LOGIN_PWD";
	private SharedPreferences preferences;
	private Editor mEditor;

	public static final String LOGIN_NUMBER = "LOGIN_NUMBER";
	public static final String LOGIN_NAME  = "LOGIN_NAME";
	public static final String LOGIN_NAME_SAVE = "LOGIN_NAME_SAVE";//

	// Create
	public SharedPre(Context context) {
		preferences = context.getSharedPreferences(SHARED_PREFERENCE_NAME,
				Context.MODE_PRIVATE);
		mEditor = preferences.edit();
	}

	// ***********************************login
	// user*******************************
	// 得到登录号码
	public String GetLoginNumber() {
		return preferences.getString(LOGIN_NUMBER, "");
	}

	// 设置登录号码
	public void SetLoginNumber(String number) {
		mEditor.putString(LOGIN_NUMBER, number).commit();
	}


	// 得到登录密码
	public String getLoginName() {
		return preferences.getString(LOGIN_NAME, "");
	}

	// 设置登录密码
	public void SetLoginName(String password) {
		mEditor.putString(LOGIN_NAME, password).commit();
	}

	// 得到登录密码是否保存
	public boolean GetLoginNameSave() {
		return preferences.getBoolean(LOGIN_NAME_SAVE, false);
	}

	// 设置登录密码是否保存
	public void SetLoginNameSave(boolean savePassword) {
		mEditor.putBoolean(LOGIN_NAME_SAVE, savePassword).commit();
	}

}
